<div id="block"><!-- --></div>
<div id="page">
	<?php if(User::is_authenticated()): ?>
	<div id="profile_popup" class="popup">
		<p class="title"><?php echo lang('profile'); ?><a class="close"><?php echo lang('close_popup'); ?></a></p>
		<div class="clear"><!-- --></div>
		<?php
		$GLOBALS['profile']->output(array
		(
			'errors'	=>	'label'
		));
		?>
	</div>
	<?php else: ?>
	<div id="register_popup" class="popup">
		<p class="title"><?php echo lang('register'); ?><a class="close"><?php echo lang('close_popup'); ?></a></p>
		<div class="clear"><!-- --></div>
		<?php if($GLOBALS['register']->submitted && $GLOBALS['register']->valid): ?>
		<p class="info"><?php echo lang('register_success', array('email'=>$_POST['email'])); ?></p>
		<?php
		else:
		$GLOBALS['register']->output(array
		(
			'errors'	=>	'label'
		));
		endif;
		?>
	</div>
	<div id="log_in_popup" class="popup">
		<p class="title"><?php echo lang('log_in'); ?><a class="close"><?php echo lang('close_popup'); ?></a></p>
		<div class="clear"><!-- --></div>
		<?php
		$GLOBALS['log_in']->output(array
		(
			'errors'		=>	'label',
			'submit_right'	=>	'<a href="javascript: void(0);" id="forgot_button">'.lang('forgot_password').'</a>'
		));
		?>
	</div>
	<div id="forgot_popup" class="popup">
		<p class="title"><?php echo lang('forgot'); ?><a class="close"><?php echo lang('close_popup'); ?></a></p>
		<div class="clear"><!-- --></div>
		<?php
		if($GLOBALS['forgot']->submitted && $GLOBALS['forgot']->valid):
		?>
		<p class="info"><?php echo lang('forgot_sent'); ?></p>
		<?php
		else:
		$GLOBALS['forgot']->output(array
		(
			'errors'		=>	'label'
		));
		endif;
		?>
	</div>
	<?php if(fw::config('anonymous') == '0'): ?>
	<div id="anon_popup" class="popup">
		<p class="title"><?php echo lang('upload'); ?><a class="close"><?php echo lang('close_popup'); ?></a></p>
		<div class="clear"><!-- --></div>
		<p class="info"><?php echo lang('must_log_in', array('log_in'=>'<a href="javascript: void(0);" onclick="Popup.open(\'log_in\');">'.lang('must_log_in_button').'</a>')); ?></p>
	</div>
	<?php endif; ?>
	<?php endif; ?>
	<div id="header">
		<a href="<?php echo WEB; ?>"><img src="<?php echo WEB; ?>style/<?php echo fw::config('style'); ?>/image/logo.png" alt="Logo"/></a>
		<p id="navigation">
			<?php if(User::is_authenticated()): ?>
			<a class="welcome"><?php echo lang('welcome', array('name'=>User::username())); ?></a>
			<?php endif; ?>
			<?php if(fw::config('anonymous') == '1' || User::is_authenticated()): ?>
			<a href="<?php echo WEB; ?>"<?php if($this->controller === 'Upload'): ?> class="current"<?php endif; ?>><?php echo lang('upload'); ?></a>
			<?php else: ?>
			<a href="javascript: void(0);" id="anon_button"><?php echo lang('upload'); ?></a>
			<?php endif; ?>
			<?php if($this->action === 'view'): ?>
			<a href="<?php echo WEB.sprintf($format, $order, $range, $page); ?>"><?php echo lang('back_to_gallery'); ?></a>
			<?php else: ?>
			<a href="<?php echo WEB; ?>gallery/"<?php if($this->action === 'browse' || ($this->action === 'user' && $user_id != User::is_authenticated())): ?> class="current"<?php endif; ?>><?php echo lang('gallery'); ?></a>
			<?php endif; ?>
			<?php if(User::is_authenticated()): ?>
			<a href="<?php echo WEB; ?>user/<?php echo User::username(); ?>/"<?php if($this->action === 'user' && $user_id == User::is_authenticated()): ?> class="current"<?php endif; ?>><?php echo lang('my_images'); ?></a>
			<a href="javascript: void(0);" id="profile_button"><?php echo lang('profile'); ?></a>
			<?php if(User::is_admin()): ?>
			<a href="admin/" target="_blank"><?php echo lang('admin_panel'); ?></a>
			<?php endif; ?>
			<a href="?log_out"><?php echo lang('log_out'); ?></a>
			<?php else: ?>
			<a href="javascript: void(0);" id="register_button"><?php echo lang('register'); ?></a>
			<a href="javascript: void(0);" id="log_in_button"><?php echo lang('log_in'); ?></a>
			<?php endif; ?>
		</p>
	</div>
	<hr/>
	<?php require Template::child(); ?>
	<hr/>
	<div id="footer">
		<p class="left"><?php echo lang('copyrights', array('year'=>date('Y'))); ?></p>
		<p class="right"><?php echo lang('slogan'); ?></p>
		<div class="clear"><!-- --></div>
	</div>
</div>